<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 主键
 * @property int $corp_id 企业id
 * @property int $robot_id 机器人id
 * @property int $target_id 目标id
 * @property int $target_type 目标类型
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 * @property int $status 
 * @property-read null|ChRobot $robot 
 */
class ChRobotApply extends MineModel
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_robot_apply';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'corp_id', 'robot_id', 'target_id', 'target_type', 'created_at', 'updated_at', 'status'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'corp_id' => 'integer', 'robot_id' => 'integer', 'target_id' => 'integer', 'target_type' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'status' => 'integer'];

    public function robot()
    {
        return $this -> hasOne(ChRobot::class,'id','robot_id');
    }
}
